package jude.java.framework.thread;

import jude.java.util.Utils;

import org.apache.commons.lang.StringUtils;

public class CmdController extends Controller {

	public CmdController(Controlable target) {
		super(target);
	}

	@Override
	public void startControl() {
		while (true) {
//			if (target.isFinished()) {
//				break;
//			}
			String cmd = Utils.readCommand();
			if (StringUtils.isEmpty(cmd))
				continue;
			if (cmd.length() > 1)
				cmd = cmd.toLowerCase();
			if ("quit".equals(cmd)) {
				break;
			} else {
				onCommand(cmd);
			}
		}
	}
}
